const getters = {
    //获取商品数量
    getGoodsLength(state) {
        return state.shopCarGoods.length;
    },

    //获取选中商品总价
    getGoodsTotalPrice(state) {
        return state.shopCarGoods
            .filter(element => element.isChecked)
            .reduce((accumulator, currentValue) => {
                return  accumulator + parseFloat(currentValue.price) * currentValue.quantity
        }, 0)
    },
}

export default getters;